package com.bw.controller;

import com.bw.bean.Sugar;
import com.bw.bean.Sugar3;
import com.bw.bean.Suger2;
import com.bw.service.SugarService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class SugarController {

    @Autowired
    SugarService sugarService;

    @RequestMapping("/list1")
    public Map one(){
        List<Sugar> list=sugarService.getList1();
        return SugarUtil.getMapData(list);
    }

    @RequestMapping("/list2")
    public Map two(){
        List<Sugar> list=sugarService.getList2();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("/list3")
    public Map three(){
        List<Sugar> list=sugarService.getList3();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list4")
    public Map four(){
        List<Suger2> list=sugarService.getList4();
        List list1 = new ArrayList();
        list1.add("类别");
        list1.add("新用户");
        list1.add("老用户");
        return SugarUtil.getTablePlayData(list1,list);
    }

    @RequestMapping("/list5")
    public Map five(){
        List<Sugar> list=sugarService.getList5();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("/list6")
    public Map six(){
        List<Sugar> list=sugarService.getList6();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list7")
    public Map seven(){
        List<Sugar> list=sugarService.getList7();
        return SugarUtil.getPieData(list);
    }
    @RequestMapping("/list8")
    public Map eight(){
        List<Sugar3> list=sugarService.getList8();
        List lIst1=new ArrayList();
        lIst1.add("品牌");
        lIst1.add("类型");
        lIst1.add("总金额");
        return SugarUtil.getTablePlayData(lIst1,list);
    }

    @RequestMapping("/list9")
    public Map nine(){
        List<Sugar> list=sugarService.getList9();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list10")
    public Map ten(){
        List<Sugar> list=sugarService.getList10();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("/list11")
    public Map eleven(){
        Double list=sugarService.getList11();
        return SugarUtil.getFlipNumberData(list);
    }

    @RequestMapping("/list12")
    public Map twelve(){
        List<Sugar> list=sugarService.getList12();
        List lIst1=new ArrayList();
        lIst1.add("名字");
        lIst1.add("价钱");
        return SugarUtil.getTablePlayData(lIst1,list);
    }
}
